package Class;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;

public class InutileTransferable implements Transferable {
	
	private Inutile inutile;
    
	DataFlavor personneFlavor;
	
	/** Constructor **/
	
	public InutileTransferable(Inutile inutile) {
		this.inutile = inutile;
	}
	
	/** Method **/
	
	@Override
	public Object getTransferData(DataFlavor flavor)
			throws UnsupportedFlavorException, IOException {
		System.out.println("TransferData");
		if (InutileFlavorFactory.getInutileFlavor().equals(flavor))
            return inutile;
        else 
        	throw new UnsupportedFlavorException(flavor);
	}

	@Override
	public DataFlavor[] getTransferDataFlavors() {
		DataFlavor[] result= new DataFlavor[1];
		
	    result[0]= InutileFlavorFactory.getInutileFlavor();
        
        return result;
	}

	@Override
	public boolean isDataFlavorSupported(DataFlavor flavor) {
		System.out.println("Data flavor supported?");
		return InutileFlavorFactory.getInutileFlavor().equals(flavor);
	}
	
	/** Getter/Setter **/

	public void setInutile(Inutile inutile) {
		this.inutile = inutile;
	}

	public Inutile getInutile() {
		return inutile;
	}

}
